﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Net.Chirash.Twitter.TweetZone.WindowComponents.ViewModels;

namespace Net.Chirash.Twitter.TweetZone.WindowComponents.Containers
{
    /// <summary>
    /// DirectMessageContainer.xaml の相互作用ロジック
    /// </summary>
    public partial class DirectMessageContainer
        : Container
    {
        public DirectMessageContainer(DirectMessageViewModel viewmodel)
            : base(viewmodel)
        {
            InitializeComponent();
        }

        public DirectMessageContainer()
            : this(new DirectMessageViewModel())
        {
        }

        public override string ToString()
        {
            return "DirectMessage";
        }

        private void ListBox_ScrollChanged(object sender, ScrollChangedEventArgs e)
        {
            if (e.VerticalChange > 0.0)
            {
                double remains = e.ExtentHeight - (e.ViewportHeight + e.VerticalOffset);
                if (0.0 <= remains && remains <= 4.0)
                {
                    (ViewModel as DirectMessageViewModel).PagingStart();
                }
            }

        }

        
    }
}
